﻿namespace LS.Nc6.Application
{
    public interface IBaseInterface<T> where T : class
    {
        /// <summary>
        /// 修改实体
        /// </summary>
        /// <param name="model"></param>
        /// <param name="columns"></param>
        /// <param name="configId"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T model, Expression<Func<T, object>> columns, int configId = 0);

        /// <summary>
        /// 修改实体
        /// </summary>
        /// <param name="model"></param>
        /// <param name="configId"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T model, int configId = 0);

        /// <summary>
        /// 增加实体
        /// </summary>
        /// <param name="model"></param>
        /// <param name="configId"></param>
        /// <returns></returns>
        Task<long>  InsertAsync(T model, int configId = 0);


        /// <summary>
        /// 根据编号获取对象
        /// </summary>
        /// <param name="id"></param>
        /// <param name="configId"></param>
        /// <returns></returns>
        Task<T> GetByIdAsync(long id, int configId = 0);

        /// <summary>
        /// 逻辑删除对象
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="configId"></param>
        /// <returns></returns>
        Task<int> DeleteAsync(string ids, int configId = 0);

        /// <summary>
        /// 删除对象 
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="configId"></param>
        /// <returns></returns>
        Task<int> RemoveAsync(string ids, int configId = 0);


        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="expressionOrder"></param>
        /// <returns></returns>
        Task<List<T>> List(Expression<Func<T, bool>> expression, Expression<Func<T, object>> expressionOrder);

        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="expressionOrder"></param>
        /// <param name="expressionSelect"></param>
        /// <returns></returns>
        Task<List<T>> List(Expression<Func<T, bool>> expression, Expression<Func<T, object>> expressionOrder, Expression<Func<T, dynamic>> expressionSelect);

        /// <summary>
        /// 分页获取数据
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="expressionOrder"></param>
        /// <returns></returns>
        Task<SqlSugarPagedList<T>> PageList(Expression<Func<T, bool>> expression, int page, int limit, Expression<Func<T, object>> expressionOrder);

        Task<Tuple<List<dynamic>, int, int>> PageDynamicList(Expression<Func<T, bool>> expression, int page, int limit, Expression<Func<T, object>> expressionOrder, Expression<Func<T, dynamic>> expressionSelect);

    }
}
